package org.socialresume.client.mvp.view;

import org.socialresume.client.mvp.presenter.BodyPresenter.Display;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.Widget;

/**
 * Body Displayer using UIBinder
 */
public class BodyUI extends Composite implements Display {

	private static BodyUIUiBinder uiBinder = GWT.create(BodyUIUiBinder.class);

	interface BodyUIUiBinder extends UiBinder<Widget, BodyUI> {
	}
	
	@UiField Panel menuContainer;

	@UiField Panel updatesContainer;

	public BodyUI() {
		initWidget(uiBinder.createAndBindUi(this));
	}

	@Override
	public void addFeed(org.enunes.gwt.mvp.client.view.Display display) {
		updatesContainer.clear();
		updatesContainer.add(display.asWidget());
	}

	@Override
	public void addMenu(org.enunes.gwt.mvp.client.view.Display display) {
		updatesContainer.clear();
		menuContainer.add(display.asWidget());
	}
	
	@Override
	public Widget asWidget() {
		return this;
	}
}
